package accountsEx;

import java.util.HashMap;
import java.util.Map;

public class AccountCreator {
	private static Map<Long, Account> accounts;

    public static void createTestAccounts(){        
        if (accounts == null || accounts.isEmpty()){
            accounts = new HashMap<Long, Account>();
        }

        Account account = null;
        account = createAccountInfo(123456, "Hdfc Bank", 
		    "Jenny", "Shastri Nagar, Chennai",
            "10/05/2003", 100033.53, "Address1", 
            "jenny@gmail.com", "99123456789");
        accounts.put(account.getAccountNo(), account);

        account = createAccountInfo(234567, "Icici Bank", 
		    "Joseph", "Besant Nagar, Chennai",
            "121/09/2001", 3200033.53, "Address2", 
            "joseph@gmail.com", "99987654321");
        accounts.put(account.getAccountNo(), account);        
    }

    private static Account createAccountInfo(long accountNo, String bankName, 
	    String customerName, String branchName, String openDate, 
            double closingBalance, String address, String emailId, String phoneNumber){

        Account account = new Account();
        account.setAccountNo(accountNo);
        account.setBankName(bankName);
        account.setCustomerName(customerName);
        account.setBranchName(branchName);
        account.setOpenDate(openDate);
        account.setClosingBalance(closingBalance);
        account.setAddress(address);
        account.setEmailId(emailId);
        account.setPhoneNumber(phoneNumber);
        return account;
    }

    public static Account getAccountInfo(Long accountNo){
        return accounts.get(accountNo);
    }
}
